
function fsize(size) {
	var sizes = Array('B', 'KB', 'MB', 'GB', 'TB');
	var i = 0;
	while (size >= 1024) {
		size /= 1024;
		i++;
	}
	if (size<100) return (Math.round(size*10)/10) + " " + sizes[i];
	else return Math.round(size) + " " + sizes[i];
}

function fsizeX(size) {
	var sizes = Array('', 'K', 'M', 'G', 'T');
	var i = 0;
	while (size >= 1024) {
		size /= 1024;
		i++;
	}
	return Math.round(size) + sizes[i];
}

function GetDriveType(DriveType) {
	switch (DriveType) {
	  case 1:
	    DriveType_String = "No Root Directory";
	    break;
	  case 2:
	    DriveType_String = "Removable Disk";
	    break;
	  case 3:
	    DriveType_String = "Local Disk";
	    break;
	  case 4:
	    DriveType_String = "Network Drive";
	    break;
	  case 5:
	    DriveType_String = "Compact Disc";
	    break;
	  case 6:
	    DriveType_String = "RAM Disk";
	    break;
	
	  default:
	    DriveType_String = "Unknown";
	    break;
	}
	return DriveType_String;
}

function GetMediaType(MediaType) {
	switch (MediaType) {
	  case 1:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 1.2Mb - 512 bytes/sector";
	    break;
	  case 2:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 1.44Mb -512 bytes/sector";
	    break;
	  case 3:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 2.88Mb - 512 bytes/sector";
	    break;
	  case 4:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 20.8Mb - 512 bytes/sector";
	    break;
	  case 5:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 720Kb - 512 bytes/sector";
	    break;
	  case 6:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 360Kb - 512 bytes/sector";
	    break;
	  case 7:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 320Kb - 512 bytes/sector";
	    break;
	  case 8:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 320Kb - 1024 bytes/sector";
	    break;
	  case 9:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 180Kb - 512 bytes/sector";
	    break;
	  case 10:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 160Kb - 512 bytes/sector";
	    break;
	  case 11:
	    MediaType_String = "Removable media other than floppy";
	    break;
	  case 12:
	    MediaType_String = "Fixed hard disk media";
	    break;
	  case 13:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 120Mb - 512 bytes/sector";
	    break;
	  case 14:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 640Kb - 512 bytes/sector";
	    break;
	  case 15:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 640Kb - 512 bytes/sector";
	    break;
	  case 16:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 720Kb - 512 bytes/sector";
	    break;
	  case 17:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 1.2Mb - 512 bytes/sector";
	    break;
	  case 18:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 1.23Mb - 1024 bytes/sector";
	    break;
	  case 19:
	    MediaType_String = "5 1/4-Inch Floppy Disk - 1.23Mb - 1024 bytes/sector";
	    break;
	  case 20:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 128Mb - 512 bytes/sector";
	    break;
	  case 21:
	    MediaType_String = "3 1/2-Inch Floppy Disk - 230Mb - 512 bytes/sector";
	    break;
	  case 22:
	    MediaType_String = "8-Inch Floppy Disk - 256Kb - 128 bytes/sector";
	    break;
	
	  default:
	    MediaType_String = "Unknown";
	    break;
	}
	return MediaType_String;
}

function setFontStyle(el,fs) {
	fs=String(fs);
	var rex=/(italic|bold|narrow|expanded|condensed|smallcap|poster|compressed|fixed|fett|kursiv|standard)/gi;
	var font=fs.replace(rex,''); font=font.replace(/^\s*/,'').replace(/\s*$/, '');
	var styles=rex.exec(fs);
	if (styles){styles.shift(); var style=String(styles.join(";")).toLowerCase();}
	else var style="";

	if(style=="fett") style="bold";
	if(style=="kursiv") style="italic";

	el.font=font;
	el.style=style;
	//print ("[setFontStyle] Font:'"+font+"' Style:'"+style+"'");  
}



